Class Alarm

java.lang.Object
  extended by Alarm

public class Alarm
extends java.lang.Object

The Alarm Class creats an alarm for a European-style 12 hour clock.

Version:
May 14, 2016
Author:
Aly Moursy

Constructor Summary
Alarm()
          Constructor for objects of class Alarm.
Alarm(int hour, int minute, java.lang.String choice, java.lang.Boolean onOff)
          Constructor for objects of class Alarm.
 
Method Summary
 java.lang.String getTime()
          Return the current time of this display in the format HH:MM.
 java.lang.Boolean isSet()
          this method returns true if the alarm clock was set and false if it wasnt set.
 void setTime(int hour, int minute, java.lang.String choice)
          This method sets the time of the alarm to the specified hour and minute.
 java.lang.String turnOff()
          This method turns the alarm off, if the alarm was on it turns it off and if the alarm was already on off changes occur.
 java.lang.String turnOn()
          This method turns the alarm on, if the alarm was off it turns it on and if the alarm was already on no changes occur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alarm

public Alarm()
Constructor for objects of class Alarm. This constructor creates a clock/alarm and sets it to midnight and Alarm to Off


Alarm

public Alarm(int hour,
             int minute,
             java.lang.String choice,
             java.lang.Boolean onOff)
Constructor for objects of class Alarm. This constructor creates a clock/alarm and sets it to the time specified by the parameter and if the time is am/pm. And also sets the alarm to either on or off

Parameters:
hour: - the hour that the user would like the clock
minute: - the minute that will be displayed if 60 rollsover to 0.
choice: - lets the user choose if the time is am/pm.
onOff: - sets the alarm to either on or off.
Method Detail

getTime

public java.lang.String getTime()
Return the current time of this display in the format HH:MM.

Returns:
the current time of this display in the format HH:MM

isSet

public java.lang.Boolean isSet()
this method returns true if the alarm clock was set and false if it wasnt set.

Returns:
true if alarm is set

setTime

public void setTime(int hour,
                    int minute,
                    java.lang.String choice)
This method sets the time of the alarm to the specified hour and minute. and sets the set flag to true, so the alarm is set.

Parameters:
hour: - the hour that the user would like the clock
minute: - the minute that will be displayed if 60 rollsover to 0.
choice: - lets the user choose if the time is am/pm.

turnOff

public java.lang.String turnOff()
This method turns the alarm off, if the alarm was on it turns it off and if the alarm was already on off changes occur.

Returns:
"Turned off" if alarm was on and then turned off

turnOn

public java.lang.String turnOn()
This method turns the alarm on, if the alarm was off it turns it on and if the alarm was already on no changes occur.

Returns:
"Turnedon" if alarm was off and then turned on